#include <stdio.h>

void move(char x,int n,char z)
{

    printf("Move disk %d from %c to %c\n",n,x,z);
}

void hanoi(int n,char x,char y,char z)
{
    if(n==1)
    {
        move(x,1,z);
        return;
    }
    else
    {
        hanoi(n-1,x,z,y);
        move(x,n,z);
        hanoi(n-1,y,x,z);
    }
}

int main(void) {
    int n;
    scanf("%d",&n);
    hanoi(n,'A','B','C');
    return 0;
}
